<?php
include("../inc/Function_user.php");
upower();
$info = userinfo();

// 获取优惠券列表（示例数据，需要替换为实际的数据库查询）
$available_coupons = array(
    array(
        "id" => 1,
        "amount" => 30,
        "title" => "新客好礼券",
        "start_date" => "2020-07-26",
        "end_date" => "2020-08-26",
        "description" => "首单抵扣",
        "limit" => "仅限线下门店使用",
        "status" => 0 // 0=未领取, 1=已领取
    ),
    array(
        "id" => 2,
        "amount" => 50,
        "title" => "满100减50",
        "start_date" => "2025-11-01",
        "end_date" => "2025-12-31",
        "description" => "满额立减",
        "limit" => "全场通用",
        "status" => 0
    ),
);

// 获取我的优惠券列表
$my_coupons = array(
    array(
        "id" => 3,
        "amount" => 20,
        "title" => "会员专享券",
        "start_date" => "2025-11-01",
        "end_date" => "2025-11-30",
        "description" => "会员抵扣",
        "limit" => "线上线下通用",
        "status" => 1,
        "used" => 0 // 0=未使用, 1=已使用
    ),
);

// 分配变量到模板
$tpl->assign("info", $info);
$tpl->assign("available_coupons", $available_coupons);
$tpl->assign("my_coupons", $my_coupons);

// 显示模板
$tpl->show("coupons");
?>

